package com.yi.mall.scheduler.job;

import com.yi.mall.scheduler.service.IBuyService;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
public class LoadStockTask implements SimpleJob {

    @Autowired
    private IBuyService buyService;
    @Override
    public void execute(ShardingContext shardingContext) {
        System.out.println("库存预热开始:" + LocalDateTime.now());
        buyService.loadStock();
        System.out.println("库存预热结束:" + LocalDateTime.now());
    }
}
